#include<iostream>
#include<cmath>
using namespace std;
int t;
bool is_prime(int tar)
{
    int i = 2;
    while(i <= sqrt(float(tar)))
	{
        if(tar % i == 0)
            return false;
        i++;
    }
    return true;
}

int rev_int(int tar)
{
    int res = 0;
    while(tar!=0){
        res = res * 10 + tar % 10;
        tar = tar / 10;
    }
    return res;
}
int main()
{
    int M, N;
    cin>>M>>N;
    bool isfirst = true;
    for(int i = M; i <= N; i++)
	{
        if(is_prime(i) && is_prime(rev_int(i)))
		{
            if(!isfirst&&i!=2)
            cout<<',';
            if(i!=1)
            {
            	cout<<i;
            	t++;
			}
            isfirst = false;
        }
    }
	if(t==0)
    cout<<"No"<<endl;
}